<?php

namespace App\Models\Content;

use App\Models\Model;
use Dcat\Admin\Traits\HasDateTimeFormatter;
use Dcat\Admin\Traits\ModelTree;
use Illuminate\Database\Eloquent\SoftDeletes;
use Spatie\EloquentSortable\Sortable;

class ArticleCategory extends Model implements Sortable
{
    use SoftDeletes;
    use HasDateTimeFormatter;
    use ModelTree {
        allNodes as treeAllNodes;
        ModelTree::boot as treeBoot;
    }

    protected $fillable = [
        "display","pid","name","order","state",
    ];

    protected $table = 'article_category';

    public function getDefaultParentId()
    {
        return "0";
    }

    public function getParentColumn()
    {
        return "pid";
    }

    public function getTitleColumn()
    {
        return "name";
    }

    public function getOrderColumn()
    {
        return "order";
    }

    protected static function boot()
    {
        static::treeBoot();
    }
}
